@@ -1,3 +1,8 @@
+Changes for 0.44 Wed Sep 29 15:51:26 2010
+============================================
+* Apply a patch from brian d foy that adds a
+ debug() method for $DEBUG output.
+
Changes for 0.42 Mon Jun 28 19:35:17 2010
============================================
* Apply a patch from Robin Barker RT #56927
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Archive-Extract
-version: 0.42
+version: 0.44
abstract: Generic archive extracting mechanism
author:
- Jos Boumans <kane[at]cpan.org>
@@ -43,7 +43,7 @@ use vars qw[$VERSION $PREFER_BIN $PROGRAMS $WARN $DEBUG
$_ALLOW_BIN $_ALLOW_PURE_PERL $_ALLOW_TAR_ITER
];
-$VERSION = '0.42';
+$VERSION = '0.44';
$PREFER_BIN = 0;
$WARN = 1;
$DEBUG = 0;
@@ -402,22 +402,22 @@ sub extract {
my($na, $fail);
for my $method (@methods) {
- print "# Extracting with ->$method\n" if $DEBUG;
+ $self->debug( "# Extracting with ->$method\n" );
my $rv = $self->$method;
### a positive extraction
if( $rv and $rv ne METHOD_NA ) {
- print "# Extraction succeeded\n" if $DEBUG;
+ $self->debug( "# Extraction succeeded\n" );
$self->_extractor($method);
last;
### method is not available
} elsif ( $rv and $rv eq METHOD_NA ) {
- print "# Extraction method not available\n" if $DEBUG;
+ $self->debug( "# Extraction method not available\n" );
$na++;
} else {
- print "# Extraction method failed\n" if $DEBUG;
+ $self->debug( "# Extraction method failed\n" );
$fail++;
}
}
@@ -1515,6 +1515,21 @@ sub error {
return join $/, @$aref;
}
+=head2 debug( MESSAGE )
+
+This method outputs MESSAGE to the default filehandle if C<$DEBUG> is
+true. It's a small method, but it's here if you'd like to subclass it
+so you can so something else with any debugging output.
+
+=cut
+
+### this is really a stub for subclassing
+sub debug {
+ return unless $DEBUG;
+
+ print $_[1];
+}
+
sub _no_buffer_files {
my $self = shift;
my $file = shift or return;